package com.zatech.cgnci.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zatech.cgnci.project.base.utils.ConvertUtils;
import com.zatech.cgnci.project.dto.ReceiptPaymentBillsAddDTO;
import com.zatech.cgnci.project.dto.ReceiptPaymentBillsQueryDTO;
import com.zatech.cgnci.project.dto.ReceiptPaymentBillsUpdateDTO;
import com.zatech.cgnci.project.entity.CgnciReceiptPaymentBillsDO;
import com.zatech.cgnci.project.mapper.CgnciReceiptPaymentBillsMapper;
import com.zatech.cgnci.project.service.CgnciReceiptPaymentBillsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zatech.cgnci.project.vo.CgnciReceiptPaymentBillsVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 收付费账单表 服务实现类
 * </p>
 *
 * @author Generator
 * @since 2025-01-15
 */
@Service
public class CgnciReceiptPaymentBillsServiceImpl extends ServiceImpl<CgnciReceiptPaymentBillsMapper, CgnciReceiptPaymentBillsDO> implements CgnciReceiptPaymentBillsService {

    @Override
    public IPage<CgnciReceiptPaymentBillsVO> page(ReceiptPaymentBillsQueryDTO queryDTO) {
        return this.baseMapper.page(queryDTO.toPage(), queryDTO);
    }

    @Override
    public void insertReceiptPaymentBills(ReceiptPaymentBillsAddDTO addDTO) {
        CgnciReceiptPaymentBillsDO billsDO = ConvertUtils.convert(addDTO, CgnciReceiptPaymentBillsDO.class);
        this.save(billsDO);
    }

    @Override
    public void updateReceiptPaymentBills(ReceiptPaymentBillsUpdateDTO updateDTO) {
        CgnciReceiptPaymentBillsDO updateDO = ConvertUtils.convert(updateDTO, CgnciReceiptPaymentBillsDO.class);
        this.updateById(updateDO);
    }

    @Override
    public List<CgnciReceiptPaymentBillsVO> queryBillsByStatementNumber(Long statementNumber) {
        return this.baseMapper.selectByStatementNumber(statementNumber);
    }

}
